package club.kingyin.kyblog.core.utils.log;

import club.kingyin.kyblog.core.business.dao.admin.User;
import org.slf4j.Logger;

/**
 * @author ：kingyin
 * @date ：创建于 2021/8/29 10:41 下午
 * @description ：
 * @modified By：
 * @version: 1.0.0
 */
@Priority()
public class PostProcessorSecurity implements LogPostProcessor<Object> {
    @Override
    public void PostProcessorLog(LogResult logResult, Logger log, Object handler) {
        Object[] params = logResult.getParams();
        Object param;
        for (int i = 0; i < params.length; i++) {
            param = params[i];
            if (param instanceof User) {
                User user = (User) param;
                user.setPassword("****");
                params[i] = user;
            }
        }
    }
}
